** Replication Code for: Endres, Kyle, Costas Panagopoulos, and Donald P. Green. Forthcoming. “Elite Messaging and Partisan Consumerism: An Evaluation of Trump’s Tweets and Polarization of Corporate Brand Images.” Political Research Quarterly.


clear
use "/Users/kyleendres/Dropbox/YG Brand Data/PRQ/Final Revisions/EndresPanagopoulosGreenPRQ2020.dta"
* look firm by firm
keep if firm == "apple"
tsset id

* create DV: difference in ratings between Democrats and Republicans
gen diff = index_d - index_r
summ diff

* create DV: difference in PURCHASE INTENTION between Democrats and Republicans
gen diff_p = purchaseintent_d  - purchaseintent_r 
summ diff_p

// Table 1
* examine autocorrelations and partial autocorrelations, as well as pre-intervention drift
corrgram diff if treatment ==0
reg diff id if treatment ==0


* generate extra treamtent periods
gen treatment_month3 = l4.treatment_month2
replace treatment_month3 = 0 if treatment_month3 == .

gen treatment_month4 = l4.treatment_month3
replace treatment_month4 = 0 if treatment_month4 == .

gen treatment_month5 = l4.treatment_month4
replace treatment_month5 = 0 if treatment_month5 == .


// Table 2, Apple column 1
reg diff treatment_month1 treatment_month2 l1.diff id
// Table 2, Apple column 2
reg diff treatment_month1 treatment_month2 treatment_month3 treatment_month4  treatment_month5 l1.diff id

 


// Table 3, Column 9
reg index_d treatment_month1 treatment_month2 l1.index_d id
// Table 3, Column 10
reg index_d treatment_month1 treatment_month2 treatment_month3 treatment_month4  treatment_month5 l1.index_d id
test treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5
// Table 3, Column 11
reg index_r treatment_month1 treatment_month2 l1.index_r id
// Table 3, Column 12
reg index_r treatment_month1 treatment_month2 treatment_month3 treatment_month4  treatment_month5 l1.index_r  id
test treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5

// Table A1
reg diff_p treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5 l1.diff_p id
test treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5




clear
use "/Users/kyleendres/Dropbox/YG Brand Data/PRQ/Final Revisions/EndresPanagopoulosGreenPRQ2020.dta"
* look firm by firm
keep if firm == "macys"
tsset id

* create DV: difference in ratings between Democrats and Republicans
gen diff = index_d - index_r
summ diff

* create DV: difference in PURCHASE INTENTION between Democrats and Republicans
gen diff_p = purchaseintent_d  - purchaseintent_r 
summ diff_p

// Table 1
* examine autocorrelations and partial autocorrelations, as well as pre-intervention drift
corrgram diff if treatment ==0
reg diff id if treatment ==0


* generate extra treamtent periods
gen treatment_month3 = l4.treatment_month2
replace treatment_month3 = 0 if treatment_month3 == .

gen treatment_month4 = l4.treatment_month3
replace treatment_month4 = 0 if treatment_month4 == .

gen treatment_month5 = l4.treatment_month4
replace treatment_month5 = 0 if treatment_month5 == .


// Table 2, Macys column 1
reg diff treatment_month1 treatment_month2 l1.diff id
// Table 2, Macys column 2
reg diff treatment_month1 treatment_month2 treatment_month3 treatment_month4  treatment_month5 l1.diff id



// Table 3, Column 5
reg index_d treatment_month1 treatment_month2 l1.index_d id
// Table 3, Column 6
reg index_d treatment_month1 treatment_month2 treatment_month3 treatment_month4  treatment_month5 l1.index_d id
test treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5
// Table 3, Column 7
reg index_r treatment_month1 treatment_month2 l1.index_r id
// Table 3, Column 8
reg index_r treatment_month1 treatment_month2 treatment_month3 treatment_month4  treatment_month5 l1.index_r  id
test treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5

// Table A1
reg diff_p treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5 l1.diff_p id
test treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5



clear
use "/Users/kyleendres/Dropbox/YG Brand Data/PRQ/Final Revisions/EndresPanagopoulosGreenPRQ2020.dta"
* look firm by firm
keep if firm == "nike"
tsset id

* create DV: difference in ratings between Democrats and Republicans
gen diff = index_d - index_r
summ diff

* create DV: difference in PURCHASE INTENTION between Democrats and Republicans
gen diff_p = purchaseintent_d  - purchaseintent_r 
summ diff_p

// Table 1
* examine autocorrelations and partial autocorrelations, as well as pre-intervention drift
corrgram diff if treatment ==0
reg diff id if treatment ==0


* generate extra treamtent periods
gen treatment_month3 = l4.treatment_month2
replace treatment_month3 = 0 if treatment_month3 == .

gen treatment_month4 = l4.treatment_month3
replace treatment_month4 = 0 if treatment_month4 == .

gen treatment_month5 = l4.treatment_month4
replace treatment_month5 = 0 if treatment_month5 == .


// Table 2, Nike column 1
reg diff treatment_month1 treatment_month2 l1.diff id
// Table 2, Nike column 2
reg diff treatment_month1 treatment_month2 treatment_month3 treatment_month4  treatment_month5 l1.diff id



// Table 3, Column 1
reg index_d treatment_month1 treatment_month2 l1.index_d id
// Table 3, Column 2
reg index_d treatment_month1 treatment_month2 treatment_month3 treatment_month4  treatment_month5 l1.index_d id
test treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5
// Table 3, Column 3
reg index_r treatment_month1 treatment_month2 l1.index_r id
// Table 3, Column 4
reg index_r treatment_month1 treatment_month2 treatment_month3 treatment_month4  treatment_month5 l1.index_r  id
test treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5

// Table A1
reg diff_p treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5 l1.diff_p id
test treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5









* Appendix 2

clear
use "/Users/kyleendres/Dropbox/YG Brand Data/PRQ/Final Revisions/EndresPanagopoulosGreenPRQ2020.dta"
* look firm by firm
keep if firm == "nordstrom"
tsset id

* create DV: difference in ratings between Democrats and Republicans
gen diff = index_d - index_r
summ diff

* create DV: difference in PURCHASE INTENTION between Democrats and Republicans
gen diff_p = purchaseintent_d  - purchaseintent_r 
summ diff_p

* examine autocorrelations and partial autocorrelations, as well as pre-intervention drift
corrgram diff if treatment ==0
reg diff id if treatment ==0


* generate extra treamtent periods
gen treatment_month3 = l4.treatment_month2
replace treatment_month3 = 0 if treatment_month3 == .

gen treatment_month4 = l4.treatment_month3
replace treatment_month4 = 0 if treatment_month4 == .

gen treatment_month5 = l4.treatment_month4
replace treatment_month5 = 0 if treatment_month5 == .


// Table A2, column 1
reg diff treatment_month1 treatment_month2 l1.diff id
// Table A2, column 2
reg diff treatment_month1 treatment_month2 treatment_month3 treatment_month4  treatment_month5 l1.diff id



// Table A2, Column 3
reg index_d treatment_month1 treatment_month2 l1.index_d id
// Table A2, Column 4
reg index_d treatment_month1 treatment_month2 treatment_month3 treatment_month4  treatment_month5 l1.index_d id
test treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5
// Table A2, Column 5
reg index_r treatment_month1 treatment_month2 l1.index_r id
// Table A2, Column 6
reg index_r treatment_month1 treatment_month2 treatment_month3 treatment_month4  treatment_month5 l1.index_r  id
test treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5

// Table A2, Column 7
reg diff_p treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5 l1.diff_p id
test treatment_month1 treatment_month2 treatment_month3 treatment_month4 treatment_month5









* pooled analysis for Macy's and Nike; Endnote #9

clear
use "/Users/kyleendres/Dropbox/YG Brand Data/PRQ/Final Revisions/EndresPanagopoulosGreenPRQ2020.dta"

* look firm by firm
keep if firm == "macys" | firm == "nike"

gen firm_dummy=1
replace firm_dummy=0 if firm=="macys"

xtset firm_dummy id, generic

* create DV: difference in ratings between Democrats and Republicans
gen diff = index_d - index_r
bys firm_dummy: reg diff l1.diff treatment_month1 treatment_month2 id
* pooled
reg diff l1.diff treatment_month1 treatment_month2 id firm_dummy

* generate extra treamtent periods
gen treatment_month3 = l4.treatment_month2
replace treatment_month3 = 0 if treatment_month3 == .

gen treatment_month4 = l4.treatment_month3
replace treatment_month4 = 0 if treatment_month4 == .

gen treatment_month5 = l4.treatment_month4
replace treatment_month5 = 0 if treatment_month5 == .

* pooled
reg diff treatment_month1 treatment_month2 treatment_month3 treatment_month4  treatment_month5 l1.diff id firm_dummy

